var fs = require('fs');

//打开文件
fs.open('./files/testread.txt','r',function(err,fd){
	if(err){throw err;}

	console.log('open file success.');
	var buffer = new Buffer(255);
	//读取文件
	fs.read(fd,buffer,0,10,0,function(err,butesRead,buffer){
		if(err){throw err;}
		//打印出buffer中存入的数据
		console.log(butesRead,buffer.slice(0,butesRead).toString());

		//关闭文件
		fs.close(fd);
	});
});




















